<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
    />
    <link rel="stylesheet" href="style/style.css" />
    <title>DEMO</title>
</head>

<body>
    <div class="title">zg_wechat_sdk</div>
    <!-- 内容 -->
    <div class="share_content">
        分享页面
    </div>

    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script type="text/javascript" src="dist/zg_wechat_sdk.js"></script>
    <script type="text/javascript">
        var config = {
            appID: 'wxa2840d0838300e73',
            user_info_url: 'http://download02.chinanorth.cloudapp.chinacloudapi.cn/api/get-userinfo',
            signature_url: 'http://download02.chinanorth.cloudapp.chinacloudapi.cn/api/get-signature'
        }
        var sdk = ZGWeChatSDK.getInstance(config)
        var url = location.href
        sdk.share({
            // 分享标题
            title: 'zg_wechat_sdk',
            // 分享描述
            desc: 'zg_wechat_sdk的DEMO页面',
            // 分享链接
            link: url.substr(0, url.lastIndexOf('/')), 
            // 分享图标
            imgUrl: url.substr(0, url.lastIndexOf('/')) + '/images/logo.png',
            success: function () {
                // 用户确认分享后执行的回调函数
                console.log('share success')
            },
            cancel: function () {
                // 用户取消分享后执行的回调函数
                console.log('share cancel')
            },
            fail: function () {
                // 分享失败的回调函数
                console.log('share fail')
            }
        })
    </script>
</body>

</html>